package leetcode.秋招.荣耀;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author ：zsy
 * @date ：Created 2021/8/21 17:58
 * @description：
 */
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int max = n + 1;
        int[] dp = new int[max + 1];
        int[] nums = {4, 9};
        Arrays.fill(dp, max);
        dp[0] = 0;
        for (int i = 0; i <= n; i++) {
            for (int num : nums) {
                if (num <= i) {
                    dp[i] = Math.min(dp[i], dp[i - num] + 1);
                }
            }
        }
        System.out.println(dp[n] > n ? -1 : dp[n]);
    }
}
